<?php
/**
**百度直达号通知产品下架
**Date 2015-11-13 
**Time pm 16:00
**User by pzp
**/

include('/var/www/html/new/d/module/api/bd_zhidahao/baidu_zdh.class.php');
if (!class_exists("go_sql")){
	include("/var/www/html/new/conf/le.je");
	$le=new go_sql();
	$le->connect();
}

$BD_zdh = new BD_zdh();

$ids = explode("|",$_REQUEST['ids']);
if($_REQUEST['status'] == 0 )	$status = 2 ; //1上架 ，2下架
$signkeys = explode("|",$_REQUEST['signkey']);
$sp_no = $signkeys[0];
$secret_key = $signkeys[1];
$provider_no = $_REQUEST['supplierIdentity'];

if($ids[2]){
	$sel = "select l.title as ltitle,t.title as title from uu_land l,uu_jq_ticket t where l.id=".$ids[1]." and t.id=".$ids[2]." limit 1";
	$GLOBALS['le']->query($sel);
	$str = $GLOBALS['le']->fetch_assoc();

	$tickets = array(
		't_id'	=> $_REQUEST['ids'],  					//第三方（服务商）门票编号
		'sp_no'	=> $sp_no, 					//百度分配的店铺编号，支付时使用。
		'title'	=> $str['ltitle'].$str['ttitle'], 	//门票名称
		'status'=> $status, 					//票状态
	);

	$tickets2 = array();
	$tickets2[] = $tickets;

	$msg = json_encode($tickets2);
	$rtime = time();
	$sign32 = $BD_zdh->sign32($provider_no,$msg,$rtime,$secret_key);

	$Product_data = array(
		'provider_no'	=> $provider_no,
		'msg'			=> $msg,
		'time'			=> $rtime,
		'sign32'		=> $sign32
	); 

	$Product_post = $BD_zdh->bd_zhida_post($Product_data);
	$BD_zdh->logfile($_REQUEST['ids'].'|'.json_encode($Product_data).'|'.json_encode($Product_post),'ProductOff');
}
?>>